﻿/*****************************************************************//**
 * @file    FITKAcousticsVTKGraphObjectPictureBase.h
 * @brief   Graph object base for picture.
 *  
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-11-25
 *********************************************************************/

#ifndef __FITKACOUSTICSVTKGRAPHOBJECTPICTURENBASE_H__
#define __FITKACOUSTICSVTKGRAPHOBJECTPICTURENBASE_H__

#include "FITKAcousticsVTKGraphObject3D.h"

#include "FITKAcousticsVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkImageData;

class FITKGraphActorImage;

namespace Exchange
{
    /**
     * @brief   Graph object base for picture.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-11-25
     */
    class FITKACOUSTICSGRAPHADAPTORAPI FITKAcousticsVTKGraphObjectPictureBase : public FITKAcousticsVTKGraphObject3D
    {
        // Regist
        FITKGraphObjectRegist(FITKAcousticsVTKGraphObjectPictureBase, FITKAcousticsVTKGraphObject3D);
        FITKCLASS(Exchange, FITKAcousticsVTKGraphObjectPictureBase);

    public:
        /**
         * @brief   Constructor.
         * @param   dataObj: The data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        FITKAcousticsVTKGraphObjectPictureBase(Core::FITKAbstractDataObject* dataObj);

        /**
         * @brief   Destructor.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        virtual ~FITKAcousticsVTKGraphObjectPictureBase();

        /**
         * @brief   Update all graph actors.[virtual][override]
         * @param   forceUpdate: Force update[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        virtual void update(bool forceUpdate = false) override;

        /**
         * @brief   Highlight the graph actors.[virtual][override]
         * @param   type: The shape type need to be highlighted[default]
         * @param   color: The given color for highlighting this time[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        virtual void highlight(FITKAcousticsVTKCommons::ShapeType type = FITKAcousticsVTKCommons::ShapeTypeNone, QColor color = QColor()) override;

        /**
         * @brief   Dis-highlight the graph actors.[virtual][override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        virtual void disHighlight() override;

        /**
         * @brief   Update the actor with the camera if necessary.[virtual][override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        virtual void updateByCamera() override;

        /**
         * @brief   Set if the graph object pickable mode.[virtual][override]
         * @param   mode: The pickable mode
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        virtual void setPickMode(FITKAcousticsVTKCommons::ShapePickMode mode) override;

    protected:
        /**
         * @brief   Initialize the vtk objects.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        virtual void init();

        /**
         * @brief   Generate the picture dataset.[pure virtual]
         * @return  Is the dataset valid
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        virtual bool generateDataSet() = 0;

        /**
         * @brief   Generate the graph actors.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        virtual void generateGraph();

        /**
         * @brief   Get the enable flag from data object.[virtual]
         * @return  The enable flag
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        virtual bool getDataEnabled();

    protected:
        /**
         * @brief   The actor 2D for picture.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        FITKGraphActorImage* m_fActorImg{ nullptr };

        /**
         * @brief   The enabled picture's image dataset.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        vtkImageData* m_picData{ nullptr };

        /**
         * @brief   The enabled picture's image dataset for highlighting.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-25
         */
        vtkImageData* m_picDataHighlight{ nullptr };

        /**
         * @brief   The disable picture's image dataset.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        vtkImageData* m_picDataDisable{ nullptr };

        /**
         * @brief   The disable picture's image dataset for highlighting.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        vtkImageData* m_picDataHighlightDisable{ nullptr };

        /**
         * @brief   The picture position.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-26
         */
        double m_pos3[3]{ 0., 0., 0. };

    };
}   // namespace Exchange

#endif // __FITKACOUSTICSVTKGRAPHOBJECTPICTURENBASE_H__
